import { memo } from 'react';
import ArticleItem from './ArticleItem';
import _ from '@/utils/commonFn';
import './Article.less';

const Article = memo((props) => {
  const { item = {}, index } = props,
    { date = '', list = [] } = item;

  return (
    <div className="article-wrap box-sizing">
      {index !== 0 && (
        <div className="time-line">
          <span className="time">{_.formatTime(date, '{1}月{2}日')}</span>
        </div>
      )}
      {list.length && list.map((item) => <ArticleItem key={item.id} item={item} />)}
    </div>
  );
});

export default Article;
